/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mantechhelpdesk.dao;

import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;

/**
 *
 * @author DinhThang
 */
public class DbConnection {

    public static Connection getConnection() {
        Connection con = null;
        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//            FileReader f = new FileReader("web.config");
//            int ch = -1;
//            String str = "";
//            while ((ch = f.read()) != -1) {
//                str += (char) (ch);
//            }
//            f.close();
            con = DriverManager.getConnection("jdbc:sqlserver://MANHDD-VAIO\\SQL2008;databaseName=Helpdesk;user=sa;password=1234567");
        } catch (Exception e) {
            //JOptionPane.showMessageDialog(null, "Can't connect to databases", "Error connect", JOptionPane.ERROR_MESSAGE);
            e.printStackTrace();
        }
        return con;
    }
}
